#!/usr/bin/env python

import pexpect
import sys

child = pexpect.spawn('rman target /')
fout = file('/home/oracle/fastarea/mylog_1.txt','a')
child.logfile = fout
#child.logfile = sys.stdout

child.expect("RMAN>")
try:
#    child.sendline("backup database plus archivelog format '/home/oracle/fastre/fullback-%T-%U.bak';")
    child.sendline("backup incremental level 1 database;")
except Exception,e:
    print str(e)
child.expect("RMAN>")
child.sendline('exit')
child.close()

